#define _CRT_SECURE_NO_WARNINGS

#include <malloc.h>
#include <stdio.h>

typedef struct LNode {
	int data;
	struct LNode* next;
}LNode, *LinkList;

void Delete_x(LinkList &m, int x)
{
	LNode* p;
	if (m == NULL)
		return;
	if (m->data == x)
	{
		p = m;
		m = m->next;
		free(p);
		Delete_x(m, x);
	}
	else
	{
		Delete_x(m->next, x);
	}
}

LinkList List_HeadInsert(LinkList& L)
{
	LNode* s; int x;
	L = (LinkList)malloc(sizeof(LNode));
	L->next = NULL;
	printf(">>>>\n");
	scanf("%d", &x);
	while (x != 9999)
	{
		s = (LNode*)malloc(sizeof(LNode));
		s->data = x;
		s->next = L->next;
		L->next = s;
		scanf("%d", &x);
	}
	return L;
}


int main() {
	LNode* L;
	List_HeadInsert(L);
	Delete_x(L, 2);

	return 0;
}